Graphical output under the Microsoft Windows 3.x.RTM., Windows95.RTM., and Windows NT.RTM. operating systems is generally accomplished through calls to operating system functions. The operating system components used for carrying out graphics instructions are collectively referred to as the graphic device interface or GDI.
The Windows.RTM. GDI uses dynamically created objects or resources for carrying out drawing operations. Resources are classified into four different categories or classes: pens, brushes, palettes and fonts. One resource from each class can be currently selected at any given time. Different GDI resources are used to perform various types of drawing operations.
GDI drawing instructions can be used to form a variety of shapes or images, such as lines, arcs, regions, ellipses, polygons, rectangles, and bitmaps. Drawing a straight line is an example of a simple operation that can be performed with GDI instructions. To draw a line, a pen is created, selected, used, and then deleted. This involves four different instructions or GDI function calls: CREATEPEN, SELECTOBJECT, LINETO, and DELETEOBJECT.
GDI drawing instructions operate with reference to a two-dimensional display medium--commonly a computer's CRT. Two-dimensional coordinate pairs are thus used in many GDI instructions to specify locations for different types of graphics shapes and entities.
In addition to providing a convenient way to create device-independent graphics images, the Windows.RTM. GDI can be used to create data files for storing such images. Rather than storing the images in bit-mapped format, they are stored as an ordered sequence of GDI instructions which are later "played" to create an actual display image. The Windows.RTM. GDI contains functions for recording and storing GDI instructions in such files, which are referred to as journal files in general and as "metafiles" in the Windows environment. A metafile is simply a collection of GDI commands that creates desired text or images. Metafiles take up less space than bitmaps. In addition, they are more device-independent than bitmaps. They are also scalable in size, in that sizes and positions are specified in terms of an output frame that can be mapped to a different size during playback. For these reasons, metafiles provide convenient storage for images that appear repeatedly in an application or need to be moved from one application to another.
To generate a metafile, a Windows.RTM. application creates a special device context that sends GDI commands to a metafile for storage. The application can later play back the metafile and display the image. During playback, the GDI breaks the metafile down into records and executes the instruction defined by each record.
A metafile consists of two pertinent parts: a header and a list of records. The header contains a description of the size of the metafile, the number of drawing resources it uses, and other information. Each metafile record contains a header, a GDl instruction, and its arguments.
GDI functions and metafiles will be familiar to those accustomed to programming in the Windows.RTM. environment. For more information regarding these subjects, refer to the Windows 3.1.RTM., Windows95.RTM. and Windows NT.RTM. Programming Manuals, available from Microsoft Corporation of Redmond, Wash. These references are hereby incorporated by reference.
While metafiles offer an attractive alternative to bit-mapped files, further size reduction would be welcomed--particularly in the context of newer consumer-oriented applications which attempt to utilize graphical user interfaces to a degree that has previously not been attempted. The invention described below meets this need, compressing the data contained in metafiles by ratios not previously attainable.